from typing import List


class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        i=0
        j=len(nums)-1
        while(i<j):
            if nums[i]+nums[j]>target:j-=1
            if nums[i] + nums[j] < target: i+= 1
            if nums[i] + nums[j] == target: return [nums[i],nums[j]]

if __name__ == '__main__':
    s=Solution()
    nums = [10, 26, 30, 31, 47, 60]
    ans=s.twoSum(nums,40)
    print(ans)



